package com.woniuxy.store.app.apiImpl;
import com.woniuxy.orderService.client.CartQueryClient;
import com.woniuxy.orderService.client.result.CartItemDto;
import com.woniuxy.store.app.util.StoreIdUtil;
import com.woniuxy.store.client.CartsClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import result.Result;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/store/order")
public class CartsClientImpl implements CartsClient {
    @Resource
    CartQueryClient cartQueryClient;
    @Override
    public Result queryCart(Integer tableId) {
        Result<List<CartItemDto>> listResult = cartQueryClient.queryCart(StoreIdUtil.getFromToken(), tableId);
        List<CartItemDto> data = listResult.getData();
        return Result.success(data);
    }
}
